﻿using SnakeGame.ViewModels;
using System.Windows.Controls;

namespace SnakeGame.Views
{
    /// <summary>
    /// Interaction logic for GamePage.xaml
    /// </summary>
    public partial class GamePage : Page
    {
        private GamePageViewModel _gameViewModel;

        public GamePage()
        {
            InitializeComponent();
            _gameViewModel = (GamePageViewModel)DataContext;

        }

        public void Initialize(MainFrame mainFrame)
        {
            _gameViewModel.Initialize(mainFrame, myGrid);
            //myGrid.Children.Add()
        }

        private void ListView_PreviewMouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            var item = (ListViewItem)sender;
            if (item != null)
            {
                _gameViewModel.SelectionCommand.Execute(item.Content);
            }
        }
    }
}
